package com.moyq5.mvc.maker.test.bean.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;

import com.moyq5.mvc.maker.test.bean.enums.AdminType;

/**
 * 权限
 * @author Moyq5
 * @date 2018年4月13日
 */
@Entity
@Table(name = "sys_permit")
@DynamicUpdate
public class SysPermit implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7031788389961901008L;
	/**
	 * 权限ID
	 */
	@Id
    @GeneratedValue(strategy = GenerationType.AUTO, generator = "native")@GenericGenerator(name = "native", strategy = "native")
    @Column(name = "permit_id")
	private Long permitId;
	/**
	 * 上级权限
	 */
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	private SysPermit parent;
	/**
	 * 级别
	 */
    @Column(name = "level", precision = 2)
	private Integer level;
    /**
	 * 权限名称
	 */
	@Column(name = "name", length = 60, nullable = false)
	private String name;
	/**
	 * 管理员类型
	 */
    @Enumerated(EnumType.ORDINAL)
    @Column(name = "admin_type", precision = 2, nullable = false)
	private AdminType adminType;
	public Long getPermitId() {
		return permitId;
	}
	public void setPermitId(Long permitId) {
		this.permitId = permitId;
	}
	public SysPermit getParent() {
		return parent;
	}
	public void setParent(SysPermit parent) {
		this.parent = parent;
	}
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public AdminType getAdminType() {
		return adminType;
	}
	public void setAdminType(AdminType adminType) {
		this.adminType = adminType;
	}
}
